package com.dq.repository.category;


import com.dq.domain.category.Category;

import com.dq.domain.sys.section.SysSection;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * @author heshuaijun
 * @date 2019/9/1715:07
 */
public interface CategoryRepository extends JpaRepository<Category, Long> {

    List<Category> findByDeletedIsFalseOrderBySortNoAsc();
    List<Category> findByParentCategoryIdAndDeletedFalseOrderBySortNoAsc(Long categoryId);

    List<Category> findByDeletedIsFalseAndOrgOrderBySortNoAsc(SysSection sysDept);

    List<Category> findByParentCategoryAndOrgAndDeletedFalse(Category category, SysSection sysDept);


    List<Category> findByOrgAndDeletedFalseAndParentCategory(SysSection section, Category category);

    List<Category> findByDeletedFalseAndParentCategoryIsNotNull();

    Boolean existsByOrgAndTitleAndDeletedFalse(SysSection section, String title);
    Category findByOrgAndTitleAndDeletedFalse(SysSection section, String title);

    List<Category> findByParentCategoryAndDeletedFalse(Category category);

    List<Category> findByParentCategoryInAndDeletedFalse(List<Category> category);

}
